<?php

/**
 * this class provides building a menu
 * 
 * information:
 * please note, that the first level (main items) are only buttons from type MenuButton or LinkButton
 * 
 * - LinkButton:    use this for a button without a submenu
 * - MenuButton:    if you want to have a submenu, use this. it will add a arrow to your button
 * 
 * if want to add a submenu wo one menu button define the submenu and call function $button->setSubMenu($subMenu);
 * @author		ungerboeck simon <su@militaerversand.at>
 * @see         MainMenu class
 */
class Menu {
    private $id = null;
    private $class = null;
    private $style = null;
    private $elements = array();
    


    /************************************************************************
     ************************** PUBLIC FUNCTIONS ****************************
     ************************************************************************/
    
    /**
     * adds a button to button array
     * @param      mixed      $button    (link or menubutton)
     */
    public function addElement($element){
        array_push($this->elements, $element);
    }
    
    
    /**
     * creates the whole menu
     * @return     string     $output   
     */
    public function create(){
        $output = '<div style="' . $this->style . '">';
        foreach($this->elements as $element)
            $output .= $element->create();   
        return $output . '</div>';
    }
    
    
    /**
     * converts the menu to a string output
     * @return        string
     */
    public function __toString(){
        return $this->create();
    }


    /************************************************************************
     **************************** GETTER / SETTER ***************************
     ************************************************************************/

    public function setId($id) {
        $this->id = $id;
    }


    public function setClass($class) {
        $this->class = $class;
    }


    public function setStyle($style) {
        $this->style = $style;
    }


    public function getId() {
        return $this->id;
    }


    public function getClass() {
        return $this->class;
    }


    public function getStyle() {
        return $this->style;
    }


    /************************************************************************
     ************************** PRIVATE FUNCTIONS ***************************
     ************************************************************************/
}

?>